package com.weayer.controller;


import com.weayer.dto.ResponseResult;
import com.weayer.dto.Car;
import com.weayer.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

/**
 * @description: Service服务 - 司机 - 车辆管理controller
 * @author: Weayer
 **/
@RestController
public class CarController {
    @Autowired
    private CarService carService;

    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car){
        return carService.addCar(car);
    }
    @PutMapping("/car")
    public ResponseResult updateCar(@RequestBody Car car){
        return carService.updateCar(car);
    }
    @GetMapping("/car/{carId}")
    public ResponseResult<Car> getCarById(@PathVariable("carId") Long carId){
        return carService.getCarById(carId);
    }
}
